from django.template import Context, loader
from books.models import Book
from django.http import HttpResponse
from django.http import Http404
from django.shortcuts import render_to_response, get_object_or_404

def index(request):
	return list(request)

def list(request):
	books = Book.objects.all().order_by('title')[:10]
	return render_to_response('books/list.html', {'books': books})

def detail(request, book_id):
	book = Book.objects.get(pk=book_id)
	return render_to_response('books/detail.html', {'book': book})

